<?php

/**
 * Product filter form base class.
 *
 * @package    Manager
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseProductFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'clientCharge_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('ClientCharge'), 'add_empty' => true)),
      'agentCharge_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('AgentCharge'), 'add_empty' => true)),
      'blogger_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Blogger'), 'add_empty' => true)),
      'user_id'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('User'), 'add_empty' => true)),
      'product'             => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'url'                 => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'startdate'           => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'enddate'             => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'pledgetime'          => new sfWidgetFormFilterInput(),
      'sale'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'cost'                => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'deadline'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'client_note'         => new sfWidgetFormFilterInput(),
      'agent_note'          => new sfWidgetFormFilterInput(),
      'client_payment_time' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'agent_payment_time'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'client_request_date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'agent_request_date'  => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'          => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'clientCharge_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('ClientCharge'), 'column' => 'id')),
      'agentCharge_id'      => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('AgentCharge'), 'column' => 'id')),
      'blogger_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Blogger'), 'column' => 'id')),
      'user_id'             => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('User'), 'column' => 'id')),
      'product'             => new sfValidatorPass(array('required' => false)),
      'url'                 => new sfValidatorPass(array('required' => false)),
      'startdate'           => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'enddate'             => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'pledgetime'          => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'sale'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cost'                => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'deadline'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'client_note'         => new sfValidatorPass(array('required' => false)),
      'agent_note'          => new sfValidatorPass(array('required' => false)),
      'client_payment_time' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'agent_payment_time'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'client_request_date' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'agent_request_date'  => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'created_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'          => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('product_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Product';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'clientCharge_id'     => 'ForeignKey',
      'agentCharge_id'      => 'ForeignKey',
      'blogger_id'          => 'ForeignKey',
      'user_id'             => 'ForeignKey',
      'product'             => 'Text',
      'url'                 => 'Text',
      'startdate'           => 'Date',
      'enddate'             => 'Date',
      'pledgetime'          => 'Number',
      'sale'                => 'Number',
      'cost'                => 'Number',
      'deadline'            => 'Date',
      'client_note'         => 'Text',
      'agent_note'          => 'Text',
      'client_payment_time' => 'Date',
      'agent_payment_time'  => 'Date',
      'client_request_date' => 'Date',
      'agent_request_date'  => 'Date',
      'created_at'          => 'Date',
      'updated_at'          => 'Date',
    );
  }
}
